# -*- coding: utf-8 -*-
# owner: shenyi
# src/utils/mask.py

def mask_secret(value: str, mask_len: int = 4) -> str:
    """对敏感字符串进行掩码，如 AKIA****abcd"""
    if not value or mask_len <= 0:
        return value
    if len(value) <= mask_len * 2:
        return "****"
    return value[:mask_len] + "****" + value[-4:]